Ensure that user supplied set name values conform to the nftables identifier
syntax constraints.
Fixes: #6633
Fixes: 0484343903 ("luci-app-firewall: implement IPsets GUI")
Signed-off-by: Jo-Philipp Wich <[email protected]>
(cherry picked from commit
755edf6fbf65fa2f6b778e7edfd8b56fd1742f70)
o = s.option(form.Value, 'name', _('Name'));
o.optional = false;
o.rmempty = false;
+ o.validate = function (section_id, value) {
+ if (!/^[a-zA-Z_.][a-zA-Z0-9\/_.-]*$/.test(value))
+ return _('Invalid set name');
+
+ return true;
+ };
} else {
o = s.option(form.Value, 'name', _('Name'));
o.depends({ external: '' });